# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=mssqlscan
pkgver=0.8.4
pkgrel=3
pkgdesc='A small multi-threaded tool that scans for Microsoft SQL Servers.'
arch=('any')
url='http://www.cqure.net/wp/mssqlscan/'
license=('GPL')
depends=('java-environment')
groups=('blackarch' 'blackarch-scanner')
source=("http://www.cqure.net/tools/mssqlscan-bin-${pkgver//./_}.zip")
sha512sums=('3634292077c451f42ec719a0a53adf2105011f5cfb6931775b997e7b3bb510f1a3b2b688885bddd85973cf3fd3575933f18ad6c50be2ed5215ed2fca072326a4')

prepare() {
  cd MSSQLScan

  sed -i "/java/ i\ cd /usr/share/mssqlscan/" mssqlscan.sh
}

package() {
  cd MSSQLScan

  install -dm 755 "$pkgdir/usr/bin/"

  install -Dm 755 "$pkgname.sh" "$pkgdir/usr/share/$pkgname/$pkgname.sh"

  cp -a lib bin "$pkgdir/usr/share/$pkgname/"

  cd "$pkgdir/usr/bin"

  ln -sf "/usr/share/$pkgname/$pkgname.sh" $pkgname
}

